<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
 *
 * @package		Adminpro
 * @author		Tran Hoang Thien (thienhb12@gmail.com)
 * @copyright   PHP TEAM
 * @link		http://phpandmysql.net
 * @since		Version 1.0
 * @phone       0944418192
 *
 */
class Pages extends MY_Controller {

	public function __construct(){
		parent:: __construct();
		$this->load->model('page_model');
		$this->load->model('category_model');
		$this->load->model('page_model');
		$this->load->model('config_model');
	}

	public function index(){
		$data                      = array();
		$data['config']        = $this->cache_site->get_info_cache($key = 'config',$time = 86400,$this->config_model->get_config_info());
		$data['title']             = 'pages';
		$data['keywords']          = $data['config']['cf_seo'];
		$data['description']       = $data['config']['cf_meta'];
		$data['phone']             = $data['config']['cf_phone'];
		$data['email']             = $data['config']['cf_email'];
		$data['result_cate']   = $this->cache_site->get_info_cache($key = 'cate',$time = 86400,$this->category_model->get_data_cate());
		$data['page']          = $this->cache_site->get_info_cache($key = 'page',$time = 86400,$this->page_model->get_list_page());
		$url 					   = $this->uri->segment(1);
		$rewrite_cate			   = $this->uri->segment(2);
		$id_pages				   = end(explode('-', $rewrite_cate));
		$param_pages			   = array('p_id','p_title','p_contents','p_meta','rewrite');
		$data['result']			   = $this->page_model->get_info($id_pages,$param_pages);
		$data['title']             = $data['result']['p_title'];
		$data['template']          = 'pages/pages';
		$this->load->view("layout",$data);
	}

}

/* End of file index.php */
/* Location: ./application/modules/home/controllers/index.php */